/*
 * MainMenu.java
 *
 * Created on __DATE__, __TIME__
 */

package clientPresentation;

/**
 *
 * @author  __USER__
 */
@SuppressWarnings("serial")
public class MainMenu extends javax.swing.JFrame {

    /** Creates new form MainMenu */
    public MainMenu() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    //GEN-BEGIN:initComponents
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        optionRadio2 = new javax.swing.JRadioButton();
        optionRadio1 = new javax.swing.JRadioButton();
        jButton2 = new javax.swing.JButton();
        optionRadio3 = new javax.swing.JRadioButton();

        setTitle("Menu Principal");
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        buttonGroup1.add(optionRadio2);
        optionRadio2
        .setText("Assinar um Documento segundo uma Compet\u00eancia");

        buttonGroup1.add(optionRadio1);
        optionRadio1.setSelected(true);
        optionRadio1.setText("Certificar Compet\u00eancia");

        jButton2.setText("Ok");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        buttonGroup1.add(optionRadio3);
        optionRadio3
        .setText("Verificar Validade de um Arquivo de Documento Assinado");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
                getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(
                        layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(
                                layout.createParallelGroup(
                                        javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(optionRadio3)
                                        .addComponent(optionRadio2)
                                        .addComponent(optionRadio1)
                                        .addComponent(
                                                jButton2,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                67,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addContainerGap(
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        Short.MAX_VALUE)));
        layout.setVerticalGroup(layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(
                        layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addComponent(optionRadio1)
                        .addPreferredGap(
                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(optionRadio2)
                                .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(optionRadio3)
                                        .addPreferredGap(
                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                20, Short.MAX_VALUE)
                                                .addComponent(jButton2).addContainerGap()));

        pack();
    }// </editor-fold>
    //GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
        if (optionRadio1.isSelected()) {
            VerificationDialog vd = new VerificationDialog(this, false);
            vd.setVisible(true);
        } else if (optionRadio2.isSelected()) {
            // Abrir novo form para preenchimento de dados
//            SignatureForm sf = new SignatureForm();
//            sf.setVisible(true);
            SignatureDetailsDialog sdd = new SignatureDetailsDialog(this, false);
            sdd.setVisible(true);

        } else if (optionRadio3.isSelected()) {
            // Abrir novo form para preenchimento de dados
//            SignatureVerificationForm svf = new SignatureVerificationForm();
//            svf.setVisible(true);
            SignatureCheckDialog scd = new SignatureCheckDialog(this, false);
            scd.setVisible(true);
        } else {
            throw new RuntimeException("Invalid Radio Options State");
        }
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainMenu().setVisible(true);
            }
        });
    }

    //GEN-BEGIN:variables
    // Variables declaration - do not modify
    private javax.swing.ButtonGroup buttonGroup1;

    private javax.swing.JButton jButton2;

    private javax.swing.JRadioButton optionRadio1;

    private javax.swing.JRadioButton optionRadio2;

    private javax.swing.JRadioButton optionRadio3;
    // End of variables declaration//GEN-END:variables

}